$(function () {
    var show = document.getElementById("show");
    /*$("#submit").click*/ window.onload=(function(){
        $.ajax({
            type:"post",
            url:"http://localhost:9091/stu/select",
            data:{},
            dataType:"json",
            success:function (data){
                console.log(data)
                var arr = data;
                var str = ``;
                for(var i = 0; i < arr.length; i++){
                    str += `<tr>
									<td>${arr[i].name}</td>
									<td>${arr[i].sex}</td>
									<td>${arr[i].age}</td>
									<td>${arr[i].classes}</td>
								</tr>`;
                }
                show.innerHTML = str;

            },
            error: function() {
                alert("获取表格失败");
            }
        })

    }
    )

})
    /*$("#bsubmit").click(function () {
            var n= $("#binput").val();
            $.ajax({
                type: "get",
                //url: "http://192.168.43.41:8080/web/expert",  //路径
                url:"/web/expert",
                data: { n:n },
                dataType:"json",
                success: function (data) {
                    console.log(data);
                    var arr = data;
                    console.log(arr);

                    //通过循环创建节点添加到页面上
                    var str = ``;
                    for(var i = 0; i < arr.length; i++){
                        str += `<tr>
									<td>${arr[i].date}</td>
									<td>${arr[i].number}</td>
								</tr>`;
                    }

                    oT1.innerHTML = str;
                    alert("抽取成功");
                },


                error: function () {
                    alert("获取表格失败");
                }
            });
        }
    )})*/